package com.wxy.demo.executor;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * <p>
 * 多线程执行
 * </p>
 *
 * @author e-Xiaoyuan.Wang
 * @since 2022/10/10 18:31
 */
public class Demo2 {
    public static void main(String[] args) {
        ExecutorService service = Executors.newCachedThreadPool();
        for (int i = 0; i < 100; i++) {
            service.submit(() -> {
                System.out.println(Thread.currentThread().getName());
                try {
                    Thread.sleep(1000 * 10);
                } catch (InterruptedException ignored) {
                }
            });
        }
    }
}
